home *** CD-ROM | disk | FTP | other *** search
/ Interactive Media Design Review 1999 / Interactive Media Design Review 1999.iso / pc / Demos / Herois / Codigo.Cst / 00113_Script_Verbetes Fluxo < prev    next >
Text File  |  1999-03-19  |  10KB  |  310 lines

  1. on vaiVerbete arqNum, mediaNum
  2.   global gVerbeteAtual
  3.   -- put "vaiVerbete # carregando arquivo " & arqNum
  4.   mSetCriteria(gVerbetes, "arqNum", "=", arqNum)
  5.   mSelect(gVerbetes)
  6.   set fichas = mSelectCount(gVerbetes)
  7.   if fichas = 0 then
  8.     set arqNum = 10000
  9.     mSetCriteria(gVerbetes, "arqNum", "=", arqNum)
  10.     mSelect(gVerbetes)
  11.     set fichas = mSelectCount(gVerbetes)    
  12.   end if
  13.   global gFotoCodes
  14.   set gFotoCodes = ¼
  15.           ["filenotfound", "filenotfound", ¼
  16.            "filenotfound", "filenotfound", "filenotfound"]
  17.   
  18.   -- Verifica se existe verbete
  19.   if fichas > 0 then
  20.     
  21.     -- Empilha arqNum na pilha de paginas visitadas
  22.     empilhaArq arqNum
  23.     
  24.     sendSprite(120,#comecaAnima)
  25.     
  26.     -- Primeiro seta verbete atual, de acordo com grupo
  27.     -- a que pertence
  28.     global gEquipes, gHerois, gAstros
  29.     global gVerbeteTipo
  30.     global gAstroAtual, gEquipeAtual, gHeroiAtual
  31.     if arqNum >= gAstros then
  32.       set gAstroAtual = arqNum
  33.       set gVerbeteTipo = 2
  34.     else if arqNum >= gEquipes then
  35.       set gEquipeAtual = arqNum
  36.       set gVerbeteTipo = 1
  37.     else 
  38.       set gHeroiAtual = arqNum
  39.       set gVerbeteTipo = 0
  40.     end if
  41.     
  42.     -- Desliga subtitulos/textos/"veja mais"/... antes
  43.     repeat with i = 0 to 13 -- subtitulos texto basico
  44.       set the visibility of sprite i+2 to false
  45.     end repeat 
  46.     repeat with i = 0 to 13 -- linhas do texto basico
  47.       set the visibility of sprite i+16 to false
  48.     end repeat
  49.     set the visibility of sprite 85 to false -- historico
  50.     repeat with i = 0 to 7 -- "veja mais"
  51.       set the visibility of sprite i+57 to false
  52.     end repeat
  53.     set the visibility of sprite 30 to false -- scroll bar sumario
  54.     set the visibility of sprite 33 to false
  55.     repeat with i = 79 to 82 -- Botoes Midias
  56.       set the visibility of sprite i to false
  57.       set the member of sprite i to ¼
  58.           ((the number of member "Midias01") + i - 79)
  59.     end repeat
  60.     global gMidiaSelecionada
  61.     set gMidiaSelecionada = 0
  62.     repeat with i = 65 to 76 -- Texto/Subtitulos Midias
  63.       set the visibility of sprite i to false
  64.     end repeat
  65.     set the visibility of sprite 78 to false -- Linhas Midias
  66.     set the visibility of sprite 48 to false
  67.     set the visibility of sprite 93 to false
  68.     set the visibility of sprite 84 to false -- Indicador scroll Midias
  69.     set the editable of sprite 45 to false -- Desliga cursor no numero¼
  70.                                            -- do sprite
  71.     
  72.     -- Vai p/ frame de verbetes
  73.     go frame "Verbetes"
  74.     
  75.     -- Arruma tipo de verbete
  76.     sendSprite(44,#muda) -- Bitmap do tipo do verbete
  77.     sendSprite(54,#muda) -- Animacao do tipo do verbete
  78.     puppetSprite 86, true -- Tela de espera na foto
  79.     set the member of sprite 86 to member "esperando"
  80.     updateStage
  81.     
  82.     -- Percorre as diversas midias
  83.     repeat with i = 1 to fichas
  84.       
  85.       -- Mostra midias disponiveis
  86.       set mediaNum = mGetField(gVerbetes,"mediaNum")
  87.       if mediaNum = 2 then
  88.         set the visibility of sprite 79 to true
  89.       else if mediaNum = 4 then
  90.         set the visibility of sprite 80 to true
  91.       else if mediaNum = 8 then
  92.         set the visibility of sprite 81 to true
  93.       else if mediaNum = 16 then
  94.         set the visibility of sprite 82 to true
  95.       end if
  96.       
  97.       -- Seta codigos de fotos
  98.       set fotoCode = mGetField(gVerbetes, "fotoCode")
  99.       if fotoCode = "x" then set fotoCode = "filenotfound"
  100.       case mediaNum of
  101.         1: 
  102.           set base = the number of member 11 of castLib "Verbetes"
  103.           setAt gFotoCodes, 5, fotoCode
  104.           if fotoCode = "filenotfound" then
  105.             set the member of sprite 86 to member fotoCode          
  106.           else
  107.             global gSepPath
  108.             importFileInto member 5, ¼
  109.                 the moviePath & "Fotos" & gSepPath & fotoCode & ".jpg"
  110.             set the member of sprite 86 to member 5
  111.           end if
  112.         2: 
  113.           set base = the number of member "tv0"
  114.           setAt gFotoCodes, 1, fotoCode
  115.         4: 
  116.           set base = the number of member "cinema0"
  117.           setAt gFotoCodes, 2, fotoCode
  118.         8: 
  119.           set base = the number of member "hq0"
  120.           setAt gFotoCodes, 3, fotoCode
  121.         16: 
  122.           set base = the number of member "outras0"
  123.           setAt gFotoCodes, 4, fotoCode
  124.         otherwise beep
  125.       end case
  126.       
  127.       -- Carrega textos
  128.       repeat with counter = 0 to 17
  129.         sendSprite(120,#idleClaquete)
  130.         set mNum = mGetField(gVerbetes, "texto" & counter)
  131.         set res = leMedia(mNum, base+counter)
  132.         if (res < 0) then
  133.           beep
  134.           put "Erro lendo arquivo " & arqNum & ", midia " & mediaNum &¼
  135.               ", subtitulo " & counter & " # " & res
  136.         else if res <> 1 then
  137.           set the lineHeight of member (base+counter) to 16
  138.           if counter = 0 or mediaNum <> 1 then
  139.             set the foreColor of member (base+counter) to¼
  140.                 (the backColor of member "FundoBranco")
  141.           else
  142.             set the foreColor of member (base+counter) to¼
  143.                 (the backColor of member "FundoPreto")
  144.           end if          
  145.           if counter = 1 then 
  146.             set the fontStyle of member (base+counter) to "bold"
  147.           end if
  148.         end if
  149.       end repeat
  150.       
  151.       -- Atualiza numero atual do verbete
  152.       put arqNum into gVerbeteAtual
  153.       set the text of member "numVerbete" to String(arqNum-9999)
  154.       
  155.       -- Lista subtextos
  156.       listaSubTextos 0
  157.       
  158.       -- Continua a percorrer midias
  159.       mGoNext(gVerbetes)
  160.     end repeat
  161.     
  162.     
  163.     -- Carrega links/veja mais
  164.     global gLinks, gLinksCount, gLinksTable, gLinksDest
  165.     global gVejaMais, gVejaMaisTitulos, gVejaMaisDest
  166.     
  167.     -- Inicializa links
  168.     mSetCriteria(gLinks,"arqNum","=",arqNum)
  169.     mSelect(gLinks)
  170.     set gLinksCount = mSelectCount(gLinks)
  171.     set gLinksTable = []
  172.     set gLinksDest = []
  173.     set gLinksTitle = []
  174.     
  175.     -- Inicializa veja mais
  176.     set gVejaMais = 0
  177.     set gVejaMaisTitulos = []
  178.     set gVejaMaisDest = []
  179.     
  180.     if gLinksCount > 0 then
  181.       set links = gLinksCount
  182.       set gLinksCount = 0
  183.       set mem = the number of member "VejaMais"
  184.       --      mSetIndex(gArqs,"arqNdx")
  185.       repeat with i = 1 to links
  186.         
  187.         sendSprite(120,#idleClaquete)
  188.         
  189.         -- Le registro de link
  190.         set mNum = mGetField(gLinks, "mediaNum")
  191.         set sNum = mGetField(gLinks, "subtitNum")
  192.         set pNum = mGetField(gLinks, "palNum")
  193.         set destArq = mGetField(gLinks,"destArq")        
  194.         
  195.         -- Coloca registro na tabela
  196.         set tmp = String(mNum) & "," & String(sNum) & "," &¼
  197.                   String(pNum)
  198.         add gLinksTable, tmp
  199.         add gLinksDest, destArq
  200.         mGoNext(gLinks)
  201.         
  202.         -- Verifica se destino ja existe em veja mais
  203.         set repetido = false
  204.         set j = 1
  205.         repeat while j <= gVejaMais and not repetido
  206.           if destArq = getAt(gVejaMaisDest,j) then 
  207.             set repetido = true
  208.           end if
  209.           set j = j + 1
  210.         end repeat
  211.         if not repetido then
  212.           -- Coloca novo registro nos "VejaMais"
  213.           set gVejaMais = gVejaMais + 1
  214.           add gVejaMaisDest, destArq
  215.           mSetCriteria(gArqs,"arqNum","=",destArq)
  216.           mSelect(gArqs)
  217.           if mSelectCount(gArqs) > 0 then
  218.             set tmp = mGetField(gArqs,"arquivo")
  219.           else 
  220.             put "*** Erro, link para arquivo " & destArq
  221.             set tmp = "Link invßlido"
  222.           end if
  223.           -- Tira espaco no final de tmp
  224.           set k = length(tmp)
  225.           repeat while k > 0 and char k of tmp = SPACE
  226.             set k = k - 1
  227.           end repeat
  228.           set tmp = char 1 to k of tmp
  229.           add gVejaMaisTitulos, tmp
  230.         end if
  231.         
  232.       end repeat
  233.       
  234.     end if
  235.     sendSprite(88, #setPaginas, (gVejaMais+7)/8)
  236.     if gVejaMais > 0 then 
  237.       sendSprite(88, #setBranco, 1)
  238.     end if    
  239.     
  240.     -- Religa subtitulos/textos/links
  241.     repeat with i = 0 to 13
  242.       set the visibility of sprite i+2 to true
  243.     end repeat
  244.     repeat with i = 0 to 13
  245.       set the visibility of sprite i+16 to true
  246.     end repeat
  247.     set the visibility of sprite 85 to true
  248.     repeat with i = 0 to gLinksCount - 1
  249.       set the visibility of sprite i + 57 to true
  250.     end repeat
  251.     
  252.     sendSprite(120,#finalizaAnima)
  253.     
  254.     updateStage
  255.     
  256.     return true
  257.     
  258.     
  259.     
  260.     
  261.     -- Se nao encontrou verbete na base de dados
  262.     -- simplesmente retorna false
  263.   else
  264.     return false
  265.   end if  
  266. end
  267.  
  268. on prevVerbete
  269.   global gVerbeteAtual, gVerbeteUltimo
  270.   
  271.   put gVerbeteAtual into i
  272.   if i < 10001 then put 10001 into i
  273.   if i > gVerbeteUltimo then put gVerbeteUltimo into i
  274.   put false into res
  275.   repeat while (not res) and i > 10000
  276.     put i - 1 into i
  277.     put vaiVerbete(i,1) into res
  278.   end repeat
  279. end
  280.  
  281. on proxVerbete
  282.   global gVerbeteAtual, gVerbeteUltimo
  283.   
  284.   put gVerbeteAtual into i
  285.   if i < 10000 then put 10000 into i
  286.   if i > gVerbeteUltimo then put gVerbeteUltimo into i
  287.   put false into res
  288.   repeat while (not res) and i < gVerbeteUltimo
  289.     put i + 1 into i
  290.     put vaiVerbete(i,1) into res
  291.   end repeat
  292. end
  293.  
  294. on fazVejaMais pag
  295.   global gVejaMais, gVejaMaisDest, gVejaMaisTitulos
  296.   set k = (pag - 1) * 8 + 1
  297.   set spr = 57
  298.   repeat with i = k to k + 7
  299.     if i > gVejaMais then
  300.       set the visibility of sprite (i - k + spr) to false
  301.     else
  302.       set mem = the member of sprite (i - k + spr)
  303.       set the text of member mem to getAt(gVejaMaisTitulos, i)
  304.       set the foreColor of member mem to ¼
  305.           (the backColor of member "FundoCinza")
  306.       sendSprite(i-k+spr,#setLink,getAt(gVejaMaisDest,i))
  307.       set the visibility of sprite (i - k + spr) to true      
  308.     end if
  309.   end repeat
  310. end